{% set pypi_name = 'oslo.vmware' %}
{% set upstream_version = upstream_version('3.7.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Oslo VMware library for OpenStack projects
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('Babel') }}
BuildRequires:  {{ py3('ddt') }}
BuildRequires:  {{ py3('eventlet') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('lxml') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('netaddr') }}
BuildRequires:  {{ py3('oslo.concurrency') }}
BuildRequires:  {{ py3('oslo.context') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('suds-jurko') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildRequires:  {{ py3('urllib3') }}
BuildArch:      noarch

%description
The Oslo project intends to produce a python library containing infrastructure
code shared by OpenStack projects. The APIs provided by the project should be
high quality, stable, consistent and generally useful.

The Oslo VMware library offers session and API call management for VMware ESX/VC
server.

%package -n {{ py2name(py_versions='py3') }}
Summary:        Oslo VMware library for OpenStack projects
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('eventlet') }}
Requires:       {{ py3('lxml') }}
Requires:       {{ py3('netaddr') }}
Requires:       {{ py3('oslo.concurrency') }}
Requires:       {{ py3('oslo.context') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}
Requires:       {{ py3('suds-jurko') }}
Requires:       {{ py3('urllib3') }}

%description -n {{ py2name(py_versions='py3') }}
The Oslo project intends to produce a python library containing infrastructure
code shared by OpenStack projects. The APIs provided by the project should be
high quality, stable, consistent and generally useful.

The Oslo VMware library offers session and API call management for VMware ESX/VC
server.

This package contains the Python 3.x module.

%package        -n {{ py2name() }}-doc
Summary:        Documentation for OpenStack common VMware library
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n {{ py2name() }}-doc
Documentation for OpenStack common VMware library.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%py3_build

# generate html docs
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%py3_install

%check
# don't want to depend on hacking for package building
rm oslo_vmware/tests/test_hacking.py
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%doc README.rst
%license LICENSE
%{python3_sitelib}/oslo_vmware
%{python3_sitelib}/*.egg-info

%files -n {{ py2name() }}-doc
%doc doc/build/html
%license LICENSE

%changelog
